package n0mm4d3.RD.Rede;

import java.awt.AWTException;
import java.io.IOException;
import java.net.Socket;

import javax.swing.JOptionPane;

/**
 * Classe que permite o recebimento das coordenadas do mouse
 * @author Maelby Muniz aka n0mm4d3
 * ADS - IFPB Campus Monteiro
 */
public class RecebeCoordenadas extends Thread {
	
	private Socket socket;
	
	public RecebeCoordenadas(Socket socket) {
		setSocket(socket);
	}
	
	/**
	 * Retorna o socket utilizado
	 * @return socket
	 */
	public Socket getSocket() {
		return socket;
	}

	/**
	 * Seta / Altera o socket
	 * @param socket
	 */
	public void setSocket(Socket socket) {
		this.socket = socket;
	}

	@Override
	public void run() {
		System.out.println("RecebeCoordenadas.run()");
		try {
			ImplementaCoordenadas implementaCoordenadas = new ImplementaCoordenadas();
			implementaCoordenadas.implementaCoordenadas(getSocket());
		} catch (IOException | AWTException e) {
			JOptionPane.showMessageDialog(null, "Erro ao receber coordenadas do mouse");
			System.exit(0);
		}
	}

}
